const { Controller } = require('varal');

class ConfigController extends Controller {
	async index() {
		const serv = this.app.service('ConfigService');

		return serv.info().then((data) => {
			this.app.json({
				err_code: 0,
				data
			})
		});
	}

	async save() {
		const serv = this.app.service('ConfigService');

		return serv.save(this.app.fields).then((data) => {
			this.app.json({
				err_code: 0,
				data
			})
		});
	}
}

exports = module.exports = ConfigController;
